package net.jlibrary.group.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;

import org.hibernate.annotations.BatchSize;

import net.jlibrary.common.core.annotation.CodeGenComment;
import net.jlibrary.common.core.annotation.SeePurview;
import net.jlibrary.common.project.domain.Group;

/**
 * 停车区
 * 
 * @author fzys
 *
 */
@Entity(name = "tab_parkingplace")
@PrimaryKeyJoinColumn(name = "group_id")
@BatchSize(size = 15)
@CodeGenComment(value = "停车区管理", genSelect = false, add = false, update = false, delete = false)
@SeePurview(value = "globalPath")
public class ParkingPlace extends Group {
	private static final long serialVersionUID = 4602907494801834152L;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "area_id")
	@CodeGenComment(value = "区域", viewList = true, required = true)
	private Area area;
	@Column(length = 100)
	@CodeGenComment(value = "地址", viewList = true, required = true)
	private String address;// 地址
	@CodeGenComment(value = "经度", viewList = true, required = true)
	private double longitude;// 经度
	@CodeGenComment(value = "维度", viewList = true, required = true)
	private double latitude;// 维度
	@CodeGenComment(value = "车位数", viewList = true, required = true)
	private int totalFixedspaces;// 车位数
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "type_id")
	@CodeGenComment(value = "停车区类型", viewList = true, required = true)
	private ParkingPlaceType type;// 停车区类型
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "merchant_id")
	@CodeGenComment(value = "所属商户", viewList = true, required = true)
	private Merchant merchant;// 所属商户
	@Column(length = 100)
	@CodeGenComment(value = "车牌前缀", viewList = true)
	private String platePrefix;// 车牌前缀，如粤B

	public Area getArea() {
		return area;
	}

	public void setArea(Area area) {
		this.area = area;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public int getTotalFixedspaces() {
		return totalFixedspaces;
	}

	public void setTotalFixedspaces(int totalFixedspaces) {
		this.totalFixedspaces = totalFixedspaces;
	}

	public ParkingPlaceType getType() {
		return type;
	}

	public void setType(ParkingPlaceType type) {
		this.type = type;
	}

	public String getPlatePrefix() {
		return platePrefix;
	}

	public void setPlatePrefix(String platePrefix) {
		this.platePrefix = platePrefix;
	}

	public boolean equals(Object rhs) {
		if (rhs == null)
			return false;
		if (!(rhs instanceof Group))
			return false;
		ParkingPlace that = (ParkingPlace) rhs;
		if (this.getId() == null || that.getId() == null)
			return false;
		return (this.getId().equals(that.getId()));
	}

	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
		return result;
	}

	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}

}
